// Function to retrieve the task list data
function getAllTasks() {
    // Call the smart contract function to get the task list
    // Replace 'yourContractFunction' with the actual function name from your smart contract
    yourContractInstance.methods.getAllTasks().call()
      .then(function(taskList) {
        // Update the HTML table with the task list data
        updateTaskList(taskList);
      })
      .catch(function(error) {
        console.log(error);
      });
  }
   // Function to update the task list in the HTML table
  function updateTaskList(taskList) {
    var table = document.getElementById("taskTable");
     // Clear existing table rows
    while (table.rows.length > 1) {
      table.deleteRow(1);
    }
     // Iterate through the task list and add rows to the table
    for (var i = 0; i < taskList.length; i++) {
      var task = taskList[i];
       var row = table.insertRow(i + 1);
      row.insertCell(0).innerHTML = task.taskNumber;
      row.insertCell(1).innerHTML = task.name;
      row.insertCell(2).innerHTML = task.publisher;
      row.insertCell(3).innerHTML = task.bountyHunter;
      row.insertCell(4).innerHTML = task.reward;
      row.insertCell(5).innerHTML = task.status;
      row.insertCell(6).innerHTML = task.time;
      row.insertCell(7).innerHTML = task.evaluation;
      row.insertCell(8).innerHTML = '<button class="button" onclick="modifyStatus(' + task.taskNumber + ')">Modify</button>';
    }
  }
   // Function to handle modifying the status of a task
  function modifyStatus(taskNumber) {
    // Add your logic to modify the status of the task with the given taskNumber using MetaMask and smart contract calls
    console.log("Modify Status button clicked for Task " + taskNumber);
  }
   // Call the getAllTasks function when the page loads
  window.onload = getAllTasks;